﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
namespace MyWeb.Module
{
    public partial class mod_SlideShow : System.Web.UI.UserControl
    {
          Random rand = new Random();
          
          protected void Page_Load(object sender, EventArgs e)
          {
                     
          }
              void show1()
               {
                   int i = rand.Next(1, 5);
                   Slide1.ImageUrl = "~/Images/slide/1/" + i.ToString() + ".jpg";
               }
              void show2()
              {
                  int j = rand.Next(1, 4);
                  Slide2.ImageUrl = "~/Images/slide/2/t" + j.ToString() + ".jpg";         
              }
              void show3()
              {
                  int k = rand.Next(1, 4);
                  Slide3.ImageUrl = "~/Images/slide/3/d" + k.ToString() + ".jpg";        
              }
              protected void Timer1_Tick(object sender, EventArgs e)
              {
                  Thread t1 = new Thread(new ThreadStart(show1));
                  Thread t2 = new Thread(new ThreadStart(show2));
                  Thread t3 = new Thread(new ThreadStart(show3));

                  t1.IsBackground = true;
                  t2.IsBackground = true;
                  t3.IsBackground = true;
                  Thread.Sleep(1000);
                  t1.Start();
                  Thread.Sleep(800);
                  t2.Start();
                  Thread.Sleep(1000);
                  t3.Start(); 
              }

        
    }
}